package cn.edu.sasu.mapper;


import cn.edu.sasu.domain.entity.SysDept;
import cn.edu.sasu.domain.vo.DeptListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 王尧
 * @since 2024-04-27
 */
@Mapper
public interface DeptMapper {


    /*查询逻辑未被删除的部门*/
    List<SysDept> findSysDeptList(@Param("deleteFlag") Integer deleteFlag, @Param("offset") Integer offset, @Param("rows") Integer rows);

    /*查询逻辑未被删除的部门的数量*/
    Integer countSysDept(Integer deleteFlagYes);


    /*部门名称模糊查询*/
    List<SysDept> searchSysDeptList(@Param("deleteFlag") Integer deleteFlag, @Param("offset") Integer offset, @Param("rows") Integer rows,@Param("deptName")  String deptName);
    /*部门名称模糊查询结果数量*/
    Integer countSearchSysDept(@Param("deleteFlagYes") Integer deleteFlagYes,@Param("deptName") String deptName);


    /*根据部门名称查询部门*/
    SysDept findSysDeptByDeptName(String deptName);

    /*保存部门信息*/
    void save(SysDept dept);

    /*获取所有的部门名称*/
    List<DeptListVO> getAllDeptNames();

    /*删除*/
    Integer updateSysDeptDeleteFlagByDeptId(@Param("deptId") Integer deptId,@Param("deleteFlagYes")Integer deleteFlagYes);

    /*批量删除*/
    Integer updateSysDeptDeleteFlagByDeptIds(@Param("deptIds") List<Integer> deptIds,@Param("deleteFlagYes")  Integer deleteFlagYes);

    Integer updateInfo(SysDept dept);

    SysDept findSysDeptByDeptId(Long deptId);
}
